require('./my.less')
require('../../assets/css/index.less')
require('../../assets/fonts/iconfont.css')



const dom = require('../../utils/dom')

const https = require('../../utils/https');
const local = require('../../utils/local');
import Swiper, { Pagination, Autoplay } from 'swiper';
import 'swiper/swiper-bundle.css';


dom.ready(function() {
    dom.bMenu("my")
    Swiper.use([Pagination, Autoplay])
    var mySwiper = new Swiper('.swiper', {

        // direction: 'vertical', // 垂直切换选项
        loop: true, // 循环模式选项
        autoplay: true,
        // 如果需要分页器
        pagination: {
            el: '.swiper-pagination',
        },

        // 如果需要前进后退按钮
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },

        // 如果需要滚动条
        scrollbar: {
            el: '.swiper-scrollbar',
        },
    })

    function getUserInfo() {
        https.get("/api/user/info", function(res) {
            console.log(res, '11');
            let { errno, data } = res;
            if (errno == 0) {
                console.log(111);
                dom.gete('.pic').src = 'http://fitness.h5.itsource.cn:3701' + data.imgUrl;
                dom.gete('#user').innerHTML = data.nickName;
                console.log(dom.gete('#user').innerHTML, '222');
                dom.gete('.signature').innerHTML = data.sign;
                local.set("userdata", data)
            }

        })
    }

    getUserInfo()


    dom.addevent('#badge', function() {
        location.href = "badge.html"
    })
    dom.addevent('#rundata', function() {
        location.href = "rundata.html"
    })


})